#include <stdio.h>
#include "seq_list.cpp"

// 找出数组未出现的最小正整数
int NotAppearPositiveNum(int data[], int length)
{
    int *temp = (int *)malloc(sizeof(int) * length + 1);
    for (int i = 0; i < length + 1; i++)
        temp[i] = 0;
    for (int i = 0; i < length; i++)
        if (data[i] > 0 && data[i] < length + 1)
            temp[data[i]] = 1;

    for (int i = 1; i < length + 1; i++)
        if (temp[i] == 0)
            return i;

    return length + 1;
}

int main()
{
    int data[4] = {-5, 3, 2, 3};
    int e = NotAppearPositiveNum(data, 4);
    printf("===> %d", e);

    return 0;
}